﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

namespace 联盟酒店
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Personalmodel pe = new Personalmodel();
            pe.tel = tel.Value;
            pe.pwd = pwd.Value;
            Personalmodel r = BLL.PersonalBLL.login(pe.tel, pe.pwd);

            if (r != null)
            {

                Response.Write("<script>alert('登陆成功');location.href=('用户管理.aspx');</script>");
                Session["name"] = r.nameper;
                Session["tel"] = r.tel;
            }
            else
            {
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Personalmodel pers = new Personalmodel();
            pers.nameper = name.Value;
            pers.nid = nid.Value;
            pers.Sex = sex.Value;
            pers.tel = tels.Value;
            pers.pwd = pwds.Value;
            int rs = BLL.PersonalBLL.register(pers);
            if (rs > 0)
            {
                {
                    Response.Write("<script>alert('注册成功您可以登录了');location.href=('Login.aspx');</script>");

                }
            }
        }
    }
}